import axios from '@/utils/request';

const baseUserURL = process.env.VUE_APP_BASE_ORIGIN + '/iot_maintenance'; //维保中心

// 维保中心接口-获取报警列表
const getAlarmNoticeList = data => {
  return axios.get(baseUserURL + '/maintenance/getAlarmNoticeList', { params: data });
};

// 创建工单
const createOrder = data => {
  return axios.post(baseUserURL + '/maintenance/createOrder', data);
};
// 确认通知
const confirmAlarmNotice = data => {
  return axios.put(baseUserURL + '/maintenance/confirmAlarmNotice', data);
};
//忽略通知
const neglectAlarmNotice = data => {
  return axios.put(baseUserURL + '/maintenance/neglectAlarmNotice', data);
};
//通知延时
const delayAlarmNotice = data => {
  return axios.put(baseUserURL + '/maintenance/delayAlarmNotice', data);
};


//告警通知转工单
const transferAlarmOrder = data => {
  return axios.put(baseUserURL + '/maintenance/transferAlarmOrder', data);
};
// 获取预警详情
const getAlarmNoticeDetail = params => {
  return axios.request({
    method: 'get',
    url: baseUserURL + '/maintenance/getAlarmNoticeDetail',
    params,
    headers: {
      hideLoading: true //是否显示loading
    }
  });
};
//获取工单联系人
const getDeviceLastContact = data => {
  return axios.get(baseUserURL + '/maintenance/getDeviceLastContact', {
    params: data
  });
};
//获取设备最新的项目编号
const getDeviceLastProject = data => {
  return axios.get(baseUserURL + '/maintenance/getDeviceLastProject', {
    params: data
  });
};

export {
  getAlarmNoticeList,
  getAlarmNoticeDetail,
  confirmAlarmNotice,
  neglectAlarmNotice,
  delayAlarmNotice,
  getDeviceLastProject,
  getDeviceLastContact,
  createOrder,
  transferAlarmOrder
};
